package com.zhugang.week04;

/**
 * @program algorithms
 * @description: cellDivision
 * @author: chanzhugang
 * @create: 2022/06/15 20:42
 */
public class CellDivision {

    public static void main(String[] args) {
        CellDivision cellDivision = new CellDivision();
        int res = cellDivision.cellDivision(4);
        System.out.println(res);
    }

    /**
     * 细胞分裂： 1个细胞生命周期是3小时，1小时分裂一次
     *
     * @param n
     * @return
     */
    public int cellDivision(int n) {
        if (n == 0) return 1;
        if (n == 1) return 2;
        if (n == 2) return 4;
        if (n == 3) return 8;
        return 2 * cellDivision(n - 1) + cellDivision(n - 4);
    }
}